package com.ymatou.iapi.productcategory.testcase;

import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.userservice.parameter.req.CreateUserReq;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.database.model.Userinfo;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.utils.DiffUtil;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;

import com.ymatou.iapi.productcategory.parameter.*;
import com.ymatou.iapi.productcategory.service.*;
/**
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetBrandById{
	private static GetBrandByIdBean GetBrandByIdBean;
	private static GetBrandByIdCall GetBrandByIdCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("根据品牌Id获取品牌信息");
	}

	@Before
	public void caseUp() {
		GetBrandByIdBean=new GetBrandByIdBean();
		//旧站点
		GetBrandByIdCall=new GetBrandByIdCall(EnvSetup.getSystemUrl("productcategory_api"));
		//新站点
//		GetBrandByIdCall=new GetBrandByIdCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(GetBrandByIdCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetBrandById_001() {
		Logger.start(true,"根据品牌Id获取品牌信息成功");
		try {
			GetBrandByIdBean.setBrandId("10058");
			GetBrandByIdCall.setData(GetBrandByIdBean);
			GetBrandByIdCall.callService();			
			Logger.verifyEquals("200", GetBrandByIdCall.getString("Code"), "验证Code");
			GetBrandByIdCall GetBrandByIdCall2=new GetBrandByIdCall();
			GetBrandByIdCall2.setData(GetBrandByIdBean);
			GetBrandByIdCall2.callService();	
			DiffUtil diff=new DiffUtil();
			String difffile="diff.txt";
			diff.setLogFile(difffile);
			List<String> list=new ArrayList<>();
			list.add("Data.Brand.Level");
			diff.setIgnoreList(list);
			diff.compareJsonString(GetBrandByIdCall.getReturnData(), GetBrandByIdCall2.getReturnData());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}